package com.woniu.controller;

import com.woniu.service.DashboardService;
import com.woniu.utils.ResponseUtil;
import com.woniu.vo.MedicalRoomVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/api/dashboard")
public class DashboardController {
    @Resource
    private DashboardService dashboardService;
    //获取所有医疗科室列表 (用于下拉框)
    @GetMapping("/medical-rooms")
    public ResponseUtil getMedicalRooms() {
        ResponseUtil result = dashboardService.listMedicalRooms();
        return result;
    }

    /**
     * 根据科室ID获取所有病房和病床的实时状态
     * @param departmentId 医疗科室ID
     */
    @GetMapping("/beds")
    public ResponseUtil getBedStatusByDepartment(@RequestParam Integer departmentId) {
        ResponseUtil bedStatus
                = dashboardService.getWardAndBedStatus(departmentId);
        return bedStatus;
    }
    /**
     * *** 额外添加的新 API 接口 ***
     * 获取病床及详细病人信息
     */
    @GetMapping("/patient-beds")
    public ResponseUtil getPatientBedStatus(@RequestParam Integer departmentId) {
        ResponseUtil result
                = dashboardService.getWardAndPatientBedStatus(departmentId);
        return result;
    }
}
